<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

class Hello extends CI_Controller {
    
    private $_config;
    private $_viewFront;
    private $_staticPathPublic;

    public function __construct() {
        parent::__construct();
        
        //get config
        $this->_config = $this->config->config;
        $this->_viewFront = $this->_config['front_path'];
        $this->_staticPathPublic = $this->_config['front_public'];
        // Init data              
        $data = array();
        // Load library template
        $this->load->library('template');
        // Set template
        $this->template->set_template('default');

        // Parse data into view 
        $this->template->parse_view('header', $this->_config['front_themes'] .'header', $data);
        $this->template->parse_view('sidebar', $this->_config['front_themes'] .'sidebar', $data);
        $this->template->parse_view('footer', $this->_config['front_themes'] .'footer', $data);
        
        //Add js into template
        $this->template->add_js($this->_staticPathPublic .  'js/jquery.js');
        
        //Add css into template
        $this->template->add_css($this->_staticPathPublic . 'css/main.css');
    }

    /**
     * Index Page for this controller.
     *
     * Maps to the following URL
     * 		http://example.com/index.php/f/hello
     * 	- or -
     * 		http://example.com/index.php/f/hello/index
     * 	- or -
     * Since this controller is set as the default controller in
     * config/routes.php, it's displayed at http://example.com/
     *
     * So any other public methods not prefixed with an underscore will
     * map to /index.php/f/hello/<method_name>
     * @see http://codeigniter.com/user_guide/general/urls.html
     */
    public function index() {
        $dataView['message'] = "Hello Wolrd!";
        $this->template->parse_view('content', $this->_viewFront .'hello_view', $dataView);
        $this->template->render();
    }

    public function arc() {
        $arrInput = array(
            'sectionid' => 45
        );

        $this->load->model('frontend/article_model', 'Article', TRUE);
        $result = $this->Article->arc_GetNewestBySection($arrInput);
        print_r($result);
        die('Debug');
    }

}

/* End of file welcome.php */
/* Location: ./application/controllers/f/hello.php */